/**
 * 路由入口
 */
import { createRouter, createWebHashHistory } from 'vue-router'
import generateRoutes from './generateRoutes'
import Layout from '../layout/index.vue'
import Login from '../views/login/index.vue'
console.log(generateRoutes)
const routes = [
  {
    path: '/',
    component: Layout,
    children: generateRoutes.routerList,
  },
  {
    title: '登录',
    path: '/login',
    component: Login, 
  },
  {
    name: '404',
    title: '404',
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/404/index.vue'),
  },
]

const router = createRouter({
  scrollBehavior(/* to, from, savedPosition */) {
    return { top: 0 }
  },
  // history: createWebHashHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes: routes,
})

export default router
